home *** CD-ROM | disk | FTP | other *** search
/ X User Tools / X User Tools (O'Reilly and Associates)(1994).ISO / sources / cbzone / cbzone.z / cbzone.tar / c_defs.h < prev    next >
Text File  |  1991-01-13  |  3KB  |  74 lines

  1. /*
  2.  * cbzone_defs.h
  3.  *  -- Todd W Mummert, December 1990, CMU
  4.  *
  5.  * This file shouldn't need to be changed.
  6.  */
  7.  
  8. /* Generally useful information */
  9. #define PI 3.14159265358
  10. #define PI2 6.28318530716
  11.  
  12. /* some tolerances for certain objects */
  13. #define BMT_TOL 14400           /* tank      */
  14. #define BMC_TOL 6000            /* copter    */
  15. #define BMS_TOL 14400           /* supertank */
  16.  
  17. /*
  18.  * the following types and attributes are defined
  19.  *
  20.  * The attributes are pretty self explanatory.  The important
  21.  * thing to remember is that an object should not be removed
  22.  * if it is STILL_THERE.  The components of STILL_THERE are
  23.  * IS_ALIVE, IS_EXPLODING, ERASE, EXERASE.   ERASE and EXERASE means
  24.  * the object should be removed, but before reclaiming its space we
  25.  * should check if we need to undraw it.  ERASE and EXERASE are
  26.  * typically used when removing an object prematurely, as in the
  27.  * case of a missile run, though ERASE is also used while an
  28.  * object moves from the IS_ALIVE state to IS_EXPLODING.
  29.  */
  30. #define IS_PYRAMID       0x1
  31. #define IS_CUBE          0x2
  32. #define IS_ABLOCK        0x3
  33. #define IS_TANK          0x4
  34. #define IS_SUPER         0x8
  35. #define IS_MISSILE       0x10
  36. #define IS_COPTER        0x20
  37. #define IS_LANDER        0x40
  38. #define IS_SALVO         0x80
  39. #define IS_PLAYER        0x100
  40. #define IS_ENEMY         0x3c   /* derived */
  41. #define IS_ANYTHING      0x1ff  /* derived */
  42. #define IS_NOTBLOCK      0x1fc  /* derived */
  43.   
  44. #define LN_PYRAMID       0x0    /* the log base 2 of the above values  */
  45. #define LN_CUBE          0x1    /* we use this number to index into an */
  46. #define LN_TANK          0x2    /* array in the drawobject stage       */
  47. #define LN_SUPER         0x3
  48. #define LN_MISSILE       0x4
  49. #define LN_COPTER        0x5
  50. #define LN_LANDER        0x6
  51. #define LN_SALVO         0x7
  52.  
  53. #define IS_ALIVE         0x1
  54. #define IS_NEW           0x2
  55. #define ERASE          0x8
  56. #define EXERASE          0x10
  57. #define CAN_SHOOT        0x20
  58. #define IS_PRESET        0x40
  59. #define IS_EVADING       0x80
  60. #define IS_EXPLODING     0x100
  61. #define BLOCKED_BY_ENEMY 0x200
  62. #define BLOCKED_BY_BLOCK 0x400
  63. #define LAST_BLOCKED     0x800
  64. #define HAS_DC           0x1000
  65. #define IS_BLOCKED       0x600  /* derived */
  66. #define STILL_THERE      0x119  /* derived */  
  67. #define START_LIVING     0x3    /* derived */
  68. #define START_EXPLODING  0x10a  /* derived */
  69.  
  70. #define DIST(a,b) ((a->x-b->x)*(a->x-b->x)+(a->y-b->y)*(a->y-b->y))
  71. #define frand() ((random() & 0xffff) / 65535.0)
  72. #define ra(x) (x)*PI/180.0
  73. #define sign(v,c) ((c)<0.0?-(v):(v))
  74.